unit user_reg;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
type DRIVER_INFO_OK = record
  ModalNumber : array[0..39] of char;
  SerialNumber : array [0..19] of char;
  ControlNum : array[0..7]of char;
  DriveType : dword;
  Cylinders : dword;
  Heads : dword;
  Sectors : dword;
end;
type

  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    Edit2: TEdit;
    Label2: TLabel;
    Edit3: TEdit;
    Label3: TLabel;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Label4: TLabel;
    Label5: TLabel;
    Button3: TButton;
    Label6: TLabel;
    Button4: TButton;
    Edit7: TEdit;
    Button5: TButton;
    Button6: TButton;
    Edit8: TEdit;
    Edit9: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
  private

    { Private declarations }
  public
    { Public declarations }
  end;
  function IsWinNT:boolean;
        stdcall; external 'DiskID.dll'
        name 'IsWinNT';
  function ReadPhysicalDrive(driveID:integer;buffer:Pointer;bufLen:integer):integer;
        stdcall; external 'DiskID.dll'
        name 'ReadPhysicalDriveInNT';
  function ReadPhysicalDrive9X(driveID:integer;buffer:Pointer;bufLen:integer):integer;
        stdcall; external 'DiskID.dll'
        name 'ReadDrivePortsInWin9X';
  function getHardDriveComputerID:int64;
        stdcall; external 'DiskID.dll'
        name 'getHardDriveComputerID';
var
  Form1: TForm1;

implementation
uses md5,unit_rsa;
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
 user_name,reg_code:string;
begin
user_name:=unit_rsa.get_hard_id(true);
reg_code:=md5.MD5Print(md5.MD5String(enc(user_name,E,N)));
edit1.Text:=copy(reg_code,1,8);
edit2.Text:=copy(reg_code,9,8);
edit3.Text:=copy(reg_code,17,8);
edit4.Text:=copy(reg_code,25,8);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
    unit_rsa.run_user_regi_info_1;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
edit6.Text:=md5.MD5Print(md5.MD5String(enc(edit5.Text,E,N)));
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
    edit5.Text:=unit_rsa.get_hard_id(true);
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
  edit8.Text := unit_rsa.enc(Edit7.Text,E_1,N_1);
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
  Edit9.Text := unit_rsa.dec(Edit8.Text,D_1,N_1);
end;

end.
